
//
//  CTDisplayView.m
//  CoreText
//
//  Created by MyMac on 15/8/26.
//  Copyright (c) 2015年 tongfang. All rights reserved.
//

#import "CTDisplayView.h"
#import <CoreText/CoreText.h>
@implementation CTDisplayView


- (void)drawRect:(CGRect)rect {
    CGContextRef ctf=UIGraphicsGetCurrentContext();
    CGContextSetTextMatrix(ctf, CGAffineTransformIdentity);
    
    CGContextTranslateCTM(ctf, 0, self.bounds.size.height);
    CGContextScaleCTM(ctf, 1,-1);
  
    CGMutablePathRef path=CGPathCreateMutable();
    CGPathAddEllipseInRect(path, NULL, CGRectMake(0, 0, 70, 70));
    CGContextAddPath(ctf, path);
    CGContextStrokePath(ctf);
    NSAttributedString*attString=[[NSAttributedString alloc]initWithString:@"Hello Worid""kkkkkkkkkkkk""kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"];
    CTFramesetterRef framesetter=CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attString);
    CTFrameRef frame=CTFramesetterCreateFrame(framesetter, CFRangeMake(0, attString.length), path, NULL);

    CTFrameDraw(frame, ctf);
    
    CGPathRelease(path);
    CFRelease(frame);
    CFRelease(framesetter);
    

    
}


@end
